package com.ww.basic.fun

object funTest3 {
  def main(args: Array[String]): Unit = {
    for (i <- 1 to 64) {
      println(i + "的阶乘为：= " + factorial(i))
    }
  }

  /**
   * 递归函数
   * @param n
   * @return
   */
  def factorial(n: BigInt): BigInt = {
    if (n <= 1)
      1
    else
      n * factorial(n - 1)
  }
}
